# coding: utf-8
from sqlalchemy import Column, DateTime, Index, Integer, JSON, String, text
from sqlalchemy.ext.declarative import declarative_base


Base = declarative_base()
metadata = Base.metadata


class City(Base):
    __tablename__ = 'city'

    id = Column(String(11), primary_key=True)
    province = Column(String(255))
    city = Column(String(255))
    province_ch = Column(String(255))
    city_ch = Column(String(255))
    status = Column(Integer, server_default=text("'0'"))


class Weather(Base):
    __tablename__ = 'weather'
    __table_args__ = (
        Index('idx1', 'city_code', 'date', unique=True),
    )

    id = Column(Integer, primary_key=True)
    city_code = Column(String(11))
    tmp_max = Column(String(10))
    tmp_min = Column(String(10))
    sr = Column(String(10))
    ss = Column(String(10))
    day_weather = Column(String(10))
    night_weather = Column(String(10))
    wind_spd = Column(String(10))
    wind_level = Column(String(10))
    date = Column(DateTime)
    init_content = Column(JSON)
